<?php
namespace App\Services;

class IdCardService {

    public static function handle($birth, $gender) {
        $birth = date('Ymd', strtotime($birth));
        $gender = $gender == 'GG' ? 1 : 2;
        $characters = '0123456789X';
        $charactersLength = strlen($characters);
        $last = $characters[rand(0, $charactersLength - 1)];
        return generate_code(6) . $birth . generate_code(2) . $gender .$last;
    }


}